package main

import (
	"os"
	"os/signal"

	"smartconn.cc/cubestruct/Service/rpchandle"
	"smartconn.cc/cubestruct/Service/syswifistatus"
	"smartconn.cc/tosone/logstash"
)

func main() {
	// Status Change function must before rpchandle function
	logstash.Info("Init rpchandle for service-end ...")
	rpchandle.RPCServiceEndStart()

	// Publish code
	go syswifistatus.WifiStatusPublish()

	signalChanel := make(chan os.Signal, 1)
	signal.Notify(signalChanel, os.Interrupt)
	for {
		//logstash.Info("Enter kill ...")
		select {
		case <-signalChanel:
			rpchandle.RPCServiceEndStop()
			return
		}
	}
}
